﻿namespace Syx.Webapi.AppCode.Extensions {
    public static class IntExtension {
        //int类型扩展IsInrange方法
        public static bool IsInRange(this int checkVal, int value1, int value2) {
            // First check to see if the passed in values are in order. If so, then check to see if checkVal is between them
            if (value1 <= value2)
                return checkVal >= value1 && checkVal <= value2;
            // Otherwise invert them and check the checkVal to see if it is between them
            return checkVal >= value2 && checkVal <= value1;
        }
    }
}
